package com.wangjiang.foundation.mybatis.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 *
 *
 * @author wangjiang
 * @date 2021-01-03 03:49:22
 */
@Configuration
@EnableTransactionManagement
//@ConditionalOnProperty("mypager:true")
@MapperScanner(basePackages = { "${foundation.mybatis.mapperScan}" }, sqlSessionFactoryRef = "sqlSessionFactory")
//@MapperScan(basePackages = "${foundation.mybatis.mapperScan:com.wangjiang.foundation.mybatis.**.dao*}")
public class MybatisPlusConfig {
    /**
     * 分页插件
     */
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        return paginationInterceptor;
    }
}
